package com.study.thirdpartyeventconsumer.controller.google.complate;

import org.joda.time.DateTime;

import java.util.ArrayList;
import java.util.Date;

public class EmailTest {
    public static void main(String[] args) {
        try {
            // 创建邮件工具类实例
            EmailFetchUtil emailUtil = new EmailFetchUtil(
                "imap.163.com",           // IMAP服务器地址
                "jsp1822193376@163.com",     // 邮箱地址
                "HAd2qnxTgp2PbjzH",              // 密码
                "file"        // 附件保存路径
            );

            // 获取最后一封邮件
            Date start = DateTime.now().withTimeAtStartOfDay().minusDays(100).toDate();
            ArrayList<EmailMessage> list = emailUtil.fetchEmail(start, new Date());
            System.out.println(list);

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
